<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <!-- 兼容性 -->
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
    <title>计划编制-关键节点计划列表</title>
    <script src="/scripts/boot.js"></script>
    <style>
        html,body{
            margin:0;padding: 0;border:0;width:100%;height:100%;overflow:hidden;
        }
        body{
            background: #ffffff!important;
            padding:20px;
        }
    </style>
</head>
<body>
<div class="title-list mb-20"><span class="title-listbg"></span><span id="names"></span><span>督导记录</span></div>
<div class="mini-fit">
    <div id="datagrid1" class="mini-datagrid" style="width:100%;height:100%;"  url="/supervise/problem/listByPage" sizeList="[5,10,20,50]" pageSize="20"  idField="user_id" multiSelect="true" showEmptyText="true" emptyText="暂无数据" alwaysShowEmptyText="true">
        <div property="columns">
            <!--<div type="checkcolumn" headerAlign="center" align="center"></div>-->
            <div type="indexcolumn" headerAlign="center" align="center">编号</div>
            <div field="problem" width="120" headerAlign="center" allowSort="true">问题描述</div>
            <div field="createDate" width="120" headerAlign="center" align="center" allowSort="true" renderer="ondayRenderer">督导时间</div>
            <div field="createName" width="120" headerAlign="center" align="center" allowSort="true">督导人</div>
            <div name="action" width="200" headerAlign="center" align="center">操作</div>
        </div>
    </div>
</div>
<div class="chose-toolbar">
    <a class="chose-button" onclick="CloseWindow('close')">关闭</a>
</div>
<script type="text/javascript">
    var list = {
        //页面初始化
        init: function() {
            mini.parse();
            // mini.get("datagrid1").load();
            mini.get("datagrid1").on("drawcell", function (e) {
                var column = e.column;
                if (column.name == "action") {
                    e.cellHtml = '<a class="check-botton" href="javascript:list.view()">详情</a>';
                }
            })
        },
        SetData:function(data){
            $("#names").text(data.nodeName);
            mini.get("datagrid1").load({'planNodeId':data.id});
        },
        //    查看
        view: function(){
            var row = mini.get("datagrid1").getSelected();
            if (row) {
                mini.open({
                    url: "/planSupervision/keyPoint/view.html",
                    title: "督导记录", width: 1100, height: 700,
                    onload: function () {
                        $(".chose-button").trigger("click");
                        var iframe = this.getIFrameEl();
                        var data = {"id": row.id};
                        iframe.contentWindow.view.SetData(data);
                    },
                    ondestroy: function (action) {
                        // mini.get("datagrid1").reload();
                        $("#chose-button").click();
                    }
                });
            } else {
                alert("请选中一条记录");
            }
        },
        //    查询
        search: function () {
            var data = {
                "itemName": mini.get("itemName").getValue(),
                "cityId": mini.get("cityCombo").getValue(),
                "date": mini.get("date1").getValue()
            };
            mini.get("datagrid1").load(data);
        },
        //重置
        reset:function(){
            var form = new mini.Form("qForm");
            form.reset();
            mini.get("datagrid1").load()
        },
        //    删除
        remove: function () {
            var row = mini.get("datagrid1").getSelected();
            if (row) {
                mini.confirm("确定删除选中记录？","确定",function (action) {
                    if(action=="ok"){
                        $.ajax({
                            url: "/messageRemind/del",
                            type : "post",
                            data:{"id":row.id},
                            success: function (text) {
                                if (text.state) {
                                    mini.get("datagrid1").reload();
                                } else {
                                    mini.showMessageBox({
                                        showModal: false,
                                        width: 250,
                                        title: "提示",
                                        iconCls: "mini-messagebox-warning",
                                        message: text.message,
                                    });

                                }
                            }
                        });
                    }
                });
            } else {
                alert("请选中一条记录");
            }
        }
    };
    list.init();
</script>
</body>
</html>